package pkg

import (
	"google.golang.org/grpc"
	"google.golang.org/grpc/credentials/insecure"
	"log"
	"user_bff/user_proto"
)

//func Comment() user_proto.UserClient {
//	conn, err := grpc.Dial(
//		"consul://127.0.0.1:8500/user_srv?wait=14s",
//		grpc.WithInsecure(),
//		grpc.WithDefaultServiceConfig(`{"loadBalancingPolicy": "round_robin"}`),
//	)
//	if err != nil {
//		log.Fatal(err)
//	}
//	client := user_proto.NewUserClient(conn)
//	return client
//}

func Comment() user_proto.UserClient {
	conn, err := grpc.Dial("127.0.0.1:8888", grpc.WithBlock(), grpc.WithTransportCredentials(insecure.NewCredentials()))
	if err != nil {
		log.Println(err)
		return nil
	}
	client := user_proto.NewUserClient(conn)
	return client
}
